{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Notebook for preparing and saving MOLECULAR graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import torch\n",
    "import pickle\n",
    "import time\n",
    "import os\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download ZINC dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "downloading..\n",
      "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n",
      "                                 Dload  Upload   Total   Spent    Left  Speed\n",
      "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\n",
      "  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0\n",
      "100  366M  100  366M    0     0  4351k      0  0:01:26  0:01:26 --:--:-- 4197k\n",
      "Archive:  molecules.zip\n",
      " extracting: ../molecules/atom_dict.pickle  \n",
      " extracting: ../molecules/bond_dict.pickle  \n",
      " extracting: ../molecules/test.pickle  \n",
      " extracting: ../molecules/train.pickle  \n",
      " extracting: ../molecules/val.pickle  \n"
     ]
    }
   ],
   "source": [
    "if not os.path.isfile('molecules.zip'):\n",
    "    print('downloading..')\n",
    "    !curl https://www.dropbox.com/s/feo9qle74kg48gy/molecules.zip?dl=1 -o molecules.zip -J -L -k\n",
    "    !unzip molecules.zip -d ../\n",
    "    # !tar -xvf molecules.zip -C ../\n",
    "else:\n",
    "    print('File already downloaded')\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to DGL format and save with pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/home/vijay/graphdeeplearning/benchmarking-gnns\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "os.chdir('../../') # go to root folder of the project\n",
    "print(os.getcwd())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from data.molecules import MoleculeDatasetDGL \n",
    "\n",
    "from data.data import LoadData\n",
    "from torch.utils.data import DataLoader\n",
    "from data.molecules import MoleculeDataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "preparing 10000 graphs for the TRAIN set...\n",
      "preparing 1000 graphs for the VAL set...\n",
      "preparing 1000 graphs for the TEST set...\n",
      "Time taken: 84.0698s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'ZINC'\n",
    "dataset = MoleculeDatasetDGL(DATASET_NAME) \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAUO0lEQVR4nO3df7BndX3f8eerq9KoIBAuFncxi85qg4xZdYt0Ui2tRhDSgG1MII2ipV3IwIyOdhpI24Ha0m6sxKkTu2YJW6CjEBI0bCPGrMZKMxXlgis/pSy4wmW3uzciAsXZyvLuH99zyzfLvXfvfr/fvb8+z8fMd+75vs/nfM/n42Ff9/g553tuqgpJUhv+2kJ3QJI0fwx9SWqIoS9JDTH0Jakhhr4kNcTQl6SGGPrSAST5TJJ/vdD9kEYh3qev5S7JDuCfVtVXFrovM1kKfdTy4Jm+mpb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tOPkLvOsWiPWYt3r1zPXAqvceh7gYuA/4YuBF4NfAI8N6qWnIXRGcY26n0pgkK2AFcMDUPvlQk+TvA/wDuBp7ryr9Fb/57yR63WcZ1Lkv/mL2R3oXaFfROLm+sqo8leQ29v6NxNPBt4Ne7s+MlYZZx/TkwRu9JwtuAC/su+C4qzYW+JLXM6R1JaoihL0kNMfQlqSGGviQ1xNCXpIYY+pLUEENfkhry/wDUmEEpvt+gngAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 9 37\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAS5klEQVR4nO3df6xndX3n8eerI9IfagaWC5kC44Chbqlph+YW2VjdWXFbwKbIprpOd3VqTQcSSTX2D0aarGwTEtoVSZt2MWOgQCIIFVnJyu5KWCtrU2wHHHHoSJ3BUQdmZ64iCsHSDLz3j++52S+X7525957vdy73c5+P5JvvOZ9zzve8PznM6x4+33O+J1WFJKktP7HcBUiSxs9wl6QGGe6S1CDDXZIaZLhLUoMMd0lqkOEuzZFkU5L9y12H1IfhLk1Akg1JKskrlrsWrU6GuyQ1yHBXs5JsS/KZOW1/muTPkrwvye4kTyd5LMmlR/icK5I83q37aJLzu/af6PaxN8n3k9yR5MRus/u796eSPJPkX02ml9JohrtadhtwUZLXACRZA7wLuBU4BPwG8BrgfcB1SX557gckeT1wOfArVfVq4NeBfd3i3wfeAfxr4GeBHwB/0S17S/e+tqpeVVV/O/beSUdguKtZVfVt4CEGAQzwVuDZq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3fDNit+qGJYkg3AOcBXaPy4zukrNHZck6xJshM4BNwL7AWeqqrD3Sr7aeQP29y+VtXsMb26O6bXJTn+WNfVQrivJtcDrwM2AgeAa5e3nPFJ8irgTuBDVfWj5a5nkkb0tbnjWlXPV9VGBnennwv8/KjVjm1VkzG3r0neAHwE+JfArwAnAsd8SLGFcD/YjWXOjmkeWuZ6JqaqDnb/Ib0AfJLBP5oVrxurvBP4VFV9tmtu8riO6murxxWgqp4C/ho4D1ibZPbGyeZ+kmSorxd0Q3BVVc8Bf8kyHNMWwv1uYEs3vQX43DLWMlGzYde5BNg137orRfeF1A3A7qr6+NCi5o7rfH1t7bgmmUqytpv+KeBtDL5f+CLwW91qrRzTUX39xtCJSRh8t3DMj+lKu1rmNmATg5/UPAh8FPhvwB3AeuA7wDurasV/ETlPXzcx+F/3AvYBl86OS69USX4V+D/A14EXuuYrGYxFN3Vcj9DXzTR0XJP8IoMvTNcwOIG8o6r+KMmZDJ7tcCLwVeA/dme2K9YR+vq/gSkGv5C7E7hs6IvXY1PbSgp3SdLCtDAsI0maw3CXpAYZ7pLUIMNdkhpkuEtSgwx3SWqQ4S5JDfp/W7OqcEE42d0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 10 36\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAR90lEQVR4nO3df7DldV3H8eerVSwRA+LCbPxowSGNHFubG+n4I0othBStRHbSQM2VKWZstBKoSbRhohKZmgpbkkBThAlNCvpBZp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3gduY+cRyi9d0vr42pWY82L18Yvco4CeA2bBr5ZrO19c1Z8XDfR6HVdVumPkHBBy6wvWM01lJbummbdb8VMWgJJuAZwOfpvFrOqev0Nh1TbIhyXZgL3A9cCdwf1U93G2yi0Z+sM3ta1XNXtPzu2t6UZInrWCJi7Jaw329uBh4GrAZ2A1cuLLljE6SpwBXA79SVQ+sdD3jNKSvzV3XqtpXVZuZ+bT58cAPDNvs8a1qPOb2NckzgXOAZwA/AhwMrPopxdUa7nu6+czZec29K1zPWFTVnu4v0iPAJcz8o1nzurnKq4EPVNWHu+Ymr+mwvrZ6XQGq6n7gn4HnAAcmmf0gZHNfMTLQ1xO7KbiqqoeAP2cNXNPVGu7XAKd3y6cDH13BWsZmNuw6rwR2zLftWtG9IfVe4LaqevfAquau6Xx9be26JplIcmC3/F3Ai5l5f+HjwM91m7VyTYf19faBgUmYeW9h1V/T1XC3zBXACcx8reYe4O3AXwFXAUcBXwFeVVVr+s3Iefp5AjP/dS9gJ/Cm2XnptSrJ84F/AT4PPNI1n8vMXHRr13S+vm6hoeua5FnMvGG6gZkB4VVV9c4kxzDzuxoOBj4HvKYb2a5Zj9HXfwImmPnG2+3AmQNvvK5KKx7ukqTRW63TMpKkHgx3SWqQ4S5JDTLcJalBhrskNchwl6QGGe6S1KD/A4RQdzy2OjV7AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 11 37\n"
     ]
    }
   ],
   "source": [
    "def plot_histo_graphs(dataset, title):\n",
    "    # histogram of graph sizes\n",
    "    graph_sizes = []\n",
    "    for graph in dataset:\n",
    "        graph_sizes.append(graph[0].number_of_nodes())\n",
    "    plt.figure(1)\n",
    "    plt.hist(graph_sizes, bins=20)\n",
    "    plt.title(title)\n",
    "    plt.show()\n",
    "    graph_sizes = torch.Tensor(graph_sizes)\n",
    "    print('min/max :',graph_sizes.min().long().item(),graph_sizes.max().long().item())\n",
    "    \n",
    "plot_histo_graphs(dataset.train,'trainset')\n",
    "plot_histo_graphs(dataset.val,'valset')\n",
    "plot_histo_graphs(dataset.test,'testset')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10000\n",
      "1000\n",
      "1000\n",
      "(DGLGraph(num_nodes=29, num_edges=64,\n",
      "         ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "         edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([0.8350]))\n",
      "(DGLGraph(num_nodes=35, num_edges=78,\n",
      "         ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "         edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([0.6299]))\n",
      "(DGLGraph(num_nodes=16, num_edges=34,\n",
      "         ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "         edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([1.9973]))\n"
     ]
    }
   ],
   "source": [
    "print(len(dataset.train))\n",
    "print(len(dataset.val))\n",
    "print(len(dataset.test))\n",
    "\n",
    "print(dataset.train[0])\n",
    "print(dataset.val[0])\n",
    "print(dataset.test[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_atom_type = 28\n",
    "num_bond_type = 4\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 6.659376859664917\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "with open('data/molecules/ZINC.pkl','wb') as f:\n",
    "        pickle.dump([dataset.train,dataset.val,dataset.test,num_atom_type,num_bond_type],f)\n",
    "print('Time (sec):',time.time() - start)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test load function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[I] Loading dataset ZINC...\n",
      "train, test, val sizes : 10000 1000 1000\n",
      "[I] Finished loading.\n",
      "[I] Data load time: 8.5329s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'ZINC'\n",
    "dataset = LoadData(DATASET_NAME)\n",
    "trainset, valset, testset = dataset.train, dataset.val, dataset.test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'data.molecules.MoleculeDataset'>\n"
     ]
    }
   ],
   "source": [
    "batch_size = 10\n",
    "collate = MoleculeDataset.collate\n",
    "print(MoleculeDataset)\n",
    "train_loader = DataLoader(trainset, batch_size=batch_size, shuffle=True, collate_fn=collate)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
